package servlet;

import java.io.IOException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import session.Cart;
import session.CartBean;

public class Home extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		try {
//			InitialContext context = new InitialContext();
//			Cart cb = (Cart)context.lookup("YourCart");		
//			Context initialContext = new InitialContext(); 
//			Cart cb = (Cart)javax.rmi.PortableRemoteObject.narrow(
//				initialContext.lookup("YourCart"),
//				Cart.class);
//			String userName = cb.getOwner().getUsername();
//			request.setAttribute("UserName", userName);
			
	}
		catch (Exception e) {
			// TODO: handle exception
		}
		
		RequestDispatcher dispatcher = request.getRequestDispatcher("Home.jsp");
		if (dispatcher != null) dispatcher.forward(request, response);
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
